/**
 * Copyright 2011 By Shayne, Zhang.
 * 
 * The contents of this file are developped by Shayne, Zhang. You may visit:
 * http://www.shaynez.com for more details.
 *
 */
package com.shaynez.ec.element;

import com.shaynez.ec.exception.InvalidateValueException;

/**
 * @author shayne zhang
 *
 */
public enum Weather implements Calculatable<Weather>, ExposureElement {
	Sunny(16),
	Cloud(11),
	SnowOrSand(22),
	Overcast(8),
	SlightOvercast(11),
	HeavyOvercast(5.6f),
	Sunset(4);
	
	Weather(double apertureOfSunny16){
		this.value = apertureOfSunny16 * apertureOfSunny16;
	}
	
	private double value;
	
	@Override
	public double getValue(){
		return value;
	}

	@Override
	public Factor compare(Weather o) {
		// TODO Auto-generated method stub
		return new Factor(o.getExposureValue() / this.getExposureValue());
	}

	@Override
	public double getExposureValue() {
		// TODO Auto-generated method stub
		return value * value;
	}

	@Override
	public double getValueByExposureValue(double exposureValue) {
		// TODO Auto-generated method stub
		return java.lang.Math.sqrt(exposureValue);
	}

	@Override
	public Weather calculate(Factor factor) throws InvalidateValueException {
		// TODO Auto-generated method stub
		throw new InvalidateValueException("Weather doesn't support this function.");
	}
	
}
